<template>
  <div>
    <template v-if="readOnly && !isCreateForm">
      <div>{{ labelName }}</div>
    </template>
    <template v-else>
      <slot></slot>
    </template>
  </div>
</template>

<script>
import constants from '@/common/js/constants'
import { REQUEST_FORM } from '@/store/namespaces'
import { createNamespacedHelpers } from 'vuex'
const { mapGetters } = createNamespacedHelpers(REQUEST_FORM)

export default {
  name: 'permissionSlot',
  props: {
    readOnly: {
      type: Boolean
    },
    labelName: {
    }
  },
  computed: {
    ...mapGetters({
      formStatus: 'formStatus'
    })
  },
  data() {
    return {
      isCreateForm: {}
    }
  },
  created() {
    if (this.formStatus === constants.CREATE_FORM) {
      this.isCreateForm = true
    } else {
      this.isCreateForm = false
    }
  }
}
</script>
